﻿using System.Collections.Generic;
using Microsoft.Data.Schema.ScriptDom.Sql;
using System;
using System.IO;
using System.Diagnostics;


namespace Neznayka
{
    internal class NamedParameterUsageVisitor : TSqlConcreteFragmentVisitor
    {
        private List<Literal> _targets;

        #region ctor
        public NamedParameterUsageVisitor()
        {
            _targets = new List<Literal>();
        }
        #endregion

        #region properties
        public List<Literal> NamedParameters
        {
            get
            {
                return _targets;
            }
        }
        #endregion

        #region overrides

        public override void ExplicitVisit(ExecuteParameter node)
        {
            // <pex>
            Debug.Assert(node != (ExecuteParameter)null, "node");
            // </pex>
            Literal PV = node.Variable as Microsoft.Data.Schema.ScriptDom.Sql.Literal;
            if (PV != null && PV.LiteralType == LiteralType.Variable)
            {
                _targets.Add(PV);
            }

        }

        #endregion

    }


}